package net;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

public class quanlydocviet extends Thread {
	private Queues<msg> Sendqueue;
	private Queues<msg> CMDqueue;
	private ObjectOutputStream out;
	private ObjectInputStream in;
	private Socket socket;//moi doi tuong co mot socket rieng de nho lai day la lap trinh doi tuong
	public quanlydocviet(){}
	public quanlydocviet(Socket socket,Queues<msg> Sendqueue, Queues<msg>CMDqueue)
	{	
		
		super();
		this.Sendqueue=Sendqueue;
		this.CMDqueue=CMDqueue;
		
		this.socket=socket;
		System.out.println("chay luong cha");
		try {
			
			
			this.out=new ObjectOutputStream(this.socket.getOutputStream());
			System.out.println("chay luong cha");
			this.in=new ObjectInputStream(this.socket.getInputStream());
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			System.out.println("bi loi luong11111111111111111111111111111134353");
		}
		
		
	}
	public void run()
	{
		
		
			System.out.print("luong quan ly doc viet ");
			
				
			
				ParaReader parareader=new ParaReader(in, CMDqueue);
				Thread threaddoc=new Thread( parareader);
				threaddoc.start();
			
			
			
				
				ParaWriter parawriter=new ParaWriter(out, Sendqueue);
				Thread threadghi=new Thread(parawriter) ;
				threadghi.start();
			
			
			
		
		
		}

}
